import request from '@/utils/request'

// 查询文件分享列表
export function listSysShareFiles(query) {
  return request({
    url: '/files/sysShareFiles/list',
    method: 'get',
    params: query
  })
}

// 查询文件分享列表
export function findListRecord(query) {
  return request({
    url: '/files/sysShareFiles/listRecord',
    method: 'get',
    params: query
  })
}

// 查询文件分享列表,不分页
export function listAllSysShareFiles(query) {
  return request({
    url: '/files/sysShareFiles/listAll',
    method: 'get',
    params: query
  })
}

// 查询文件分享详细
export function getSysShareFiles(id) {
  return request({
    url: '/files/sysShareFiles/' + id,
    method: 'get'
  })
}

// 保存文件分享
export function saveSysShareFiles(data) {
  return request({
    url: '/files/sysShareFiles/save',
    method: 'post',
    data: data
  })
}

// 删除文件分享
export function delSysShareFiles(id) {
  return request({
    url: '/files/sysShareFiles/' + id,
    method: 'delete'
  })
}

// 导出文件分享
export function exportSysShareFiles(query) {
  return request({
    url: '/files/sysShareFiles/export',
    method: 'get',
    params: query
  })
}

// 查看分享的文件
export function viewSharedFiles(id, type, userName, phoneNumber, code, tenantCode, Authorization) {
  id = id === undefined ? '' : id
  type = type === undefined ? '' : type
  userName = userName === undefined ? '' : userName
  Authorization = Authorization === undefined ? '' : Authorization
  phoneNumber = phoneNumber === undefined ? '' : phoneNumber
  code = code === undefined ? '' : code
  tenantCode = tenantCode === undefined ? '' : tenantCode
  // console.log(id, type, Authorization)
  return request({
    url: '/files/sysShareFiles/home?id=' + id + '&type=' + type + '&userName=' + userName + '&phoneNumber=' + phoneNumber + '&code=' + code + '&tenantCode=' + tenantCode + '&Authorization=' + Authorization,
    method: 'get'
  })
}

// 获取短信验证码
export function SMSVerificationCode(phoneNumber) {
  return request({
    url: '/SMSVerificationCode?phoneNumber=' + phoneNumber,
    method: 'get'
  })
}

// 修改启用状态
export function enabledStateSwitch(id, status) {
  return request({
    url: '/files/sysShareFiles/enabledStateSwitch/' + id + '/' + status,
    method: 'get'
  })
}

// 查询文件分享访问记录列表
export function listSysSharingAccessRecord(query) {
  return request({
    url: '/files/sysShareFiles/sysSharingAccessRecord/list',
    method: 'get',
    params: query
  })
}
